﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ExpertMIS.Brokers;
using ExpertMIS.Entities;

namespace ExpertMIS.UserControl
{
    public partial class ucDomainExperts : System.Web.UI.UserControl
    {
        public void RefreshDomainExperts(string domainOID)
        {
            ExpertBroker broker = new ExpertBroker();

            List<string> domains = new List<string>();
            repExperts.DataSource = broker.GetExpertsByDomain(domainOID);
            repExperts.DataBind();
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void repExperts_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                ExpertEntity entity = e.Item.DataItem as ExpertEntity;
                ucExpertShort ucShort = e.Item.FindControl("ucExpertShort1") as ucExpertShort;
                if (entity != null && ucShort != null)
                {
                    ucShort.Expert = entity;
                }
            }
        }
    }
}